package com.bluegalaxy.nhb.snservice.core.util;

import org.apache.poi.xssf.usermodel.XSSFCell;

/**
 * Created by JunFei on 2020/5/14.
 */
public class POIUtil {

    public static String getCellValue(XSSFCell cell){
        String retrunMsg= "";
        switch (cell.getCellType()) {
            case XSSFCell.CELL_TYPE_BLANK:
                retrunMsg= "";
                break;
            case XSSFCell.CELL_TYPE_NUMERIC:
                Double d = cell.getNumericCellValue();
                retrunMsg = String.valueOf(d);
                break;
            case XSSFCell.CELL_TYPE_STRING:
                retrunMsg = cell.getStringCellValue();
                break;
            case XSSFCell.CELL_TYPE_FORMULA:
                retrunMsg = cell.getCellFormula();
                break;
            case  XSSFCell.CELL_TYPE_BOOLEAN:
                Boolean b = cell.getBooleanCellValue();
                retrunMsg = String.valueOf(b);
                break;
            case XSSFCell.CELL_TYPE_ERROR:
                retrunMsg = "";
                break;
        }
        return retrunMsg;
    }

}
